package com.wf.hutoolTest;

import cn.hutool.core.clone.CloneRuntimeException;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.RandomUtil;
import lombok.Data;
import com.wf.day_0607.test5.Phone;

import java.util.Set;

/**
 * 猫猫类，使用实现Cloneable方式
 * @author Looly
 *
 */

public class CloneTest
{
    public static void main(String[] args) {

        Cat cat = new Cat();
        Phone phone = new Phone("iPhone 15 pro max", 8888.88);
        cat.setPhone(phone);
        Cat clone = cat.clone();
        phone.setPrice(12.0);
        clone.setName("AA");
        System.out.println(cat.toString());
        System.out.println(clone.toString());

        System.out.println(cat==clone);
        Set<Integer> integers = RandomUtil.randomEleSet(CollUtil.newArrayList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 5);

        integers.forEach(System.out::println);
        System.out.println(Convert.chineseToNumber("一千零一十二"));
        System.out.println(Convert.chineseToNumber("二"));
        System.out.println(Convert.chineseToNumber("三"));
        System.out.println(Convert.chineseToNumber("一千零一十二"));
        System.out.println(Convert.chineseToNumber("一千零一十二"));
        System.out.println(Convert.numberToChinese(1.0, true));
    }
}
@Data
 class Cat implements Cloneable {

    private String name = "miaomiao";
    private int age = 2;
    private Phone phone;
    
    @Override
    public Cat clone() {
        try {
            return (Cat) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new CloneRuntimeException(e);
        }
    }
}